#include <error.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
int main()
{
    int fd = open("test.txt", O_CREAT|O_RDWR|O_EXCL, 0644);
    if(fd == -1)
    {
        perror("open:");
        return -1;
    }
    const char* msg = "hello\n";
    write(fd, msg, strlen(msg) );
    close(fd);
    return 0;
}
